Skip to content

接入 C++ C# Lua Luau 语法候选资产 - #22

Merged
loong10k merged 2 commits into
mainfrom
feat/rust-hook-prompt-guidance
Sep 29, 2026
Merged

loong10k merged 2 commits into
mainfrom
feat/rust-hook-prompt-guidance

Conversation

@loong10k

@loong10k loong10k commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

问题与结果

CodeGraph 随仓的 C++、C#、Lua、Luau WASM 尚未进入 CodeGuard 固定资产清单。此变更固定四份原始字节、上游标签提交、许可证和真实 ABI,并接入 Rust 隔离 worker。C# 的公开语言 ID csharp 与 WASM 导出符号 c_sharp 分开固定,篡改符号声明会被拒绝。

候选清单的 JSON Schema 原先只接受四份资产,已经不能验证当前内容;现在与当前封闭字段、依赖包元数据和 32 种目标语言保持一致,并增加清单与 schema 同步的回归测试。只读 grammar status 报告 32 种来源、15 份未验收候选、0 项已发行。基础正反语法样例可区分,但 C++ 宏/模板、C# 预处理和 Lua/Luau 方言尚无完整语料与原生对照;候选观察保持 incomplete,没有公开 lint 路由或交付权威。

验证

  • 清单候选数先从 11 改为 15,目标测试因实际只有 11 份而失败;C++ ABI 先按 15 声明时加载测试失败,实测后固定为 14。
  • Rust 离线加载四份资产并区分基础合法/损坏样例;隔离 worker 四种语言均返回 incomplete、grammar_qualified=false。
  • 资产与 worker 变更的本地 cargo test --locked --workspace --all-features:182 组、1136 通过、0 失败、106 条有条件忽略。后续 schema 修正的定向测试 6/6 通过,更新后整轮由 PR gate 复核。
  • cargo clippy --locked --workspace --all-targets --all-features -- -D warnings、cargo fmt --all -- --check、OpenSpec strict 校验通过。
  • 使用本机已有 jsonschema 4.25.1 按 Draft 2020-12 验证当前 15 份清单通过,伪造发布状态和错误 C# 符号均被拒绝。

OpenSpec 14.19 仍未完成;剩余 17 种资产、逐语言误报评测、原生优先路由与发行验收待实施。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-29T09:57:02.587180Z 2e40a81 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2e40a81f9d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"grammar_repository": {"type": "string", "pattern": "^https://github.com/tree-sitter/tree-sitter-"},
"language": {"enum": ["arkts", "c", "cfml", "cfquery", "cfscript", "cobol", "cpp", "csharp", "dart", "erlang", "go", "java", "javascript", "kotlin", "lua", "luau", "nix", "objc", "pascal", "php", "python", "r", "ruby", "rust", "scala", "solidity", "swift", "terraform", "tsx", "typescript", "vbnet", "zig"]},
"dialect": {"type": "string", "minLength": 1},
"loader_symbol": {"const": "c_sharp"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Require the C# loader symbol conditionally

For a csharp asset, omitting loader_symbol still passes this published schema because the property is not required; conversely, any other language may supply "loader_symbol": "c_sharp". The Rust manifest reader rejects both shapes, so schema-only validation can approve a manifest that the worker cannot load. Add a language-dependent condition that requires this field only when language is csharp and forbids it otherwise.

Useful? React with 👍 / 👎.

"sha256": {"$ref": "#/$defs/sha256"},
"bytes": {"type": "integer", "minimum": 8, "maximum": 8388608},
"license": {"enum": ["java/LICENSE", "python/LICENSE", "typescript/LICENSE"]},
"bytes": {"type": "integer", "minimum": 8, "maximum": 33554432},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the schema size limit aligned with the WASM loader

Assets between 8 MiB and 32 MiB now pass this schema while also being required to claim codeguard_runtime_validation: rust_loader_smoke_passed, but WasmGrammar::load unconditionally rejects inputs over 8 MiB. A schema consumer can therefore approve an impossible runtime-validation claim—for example, the documented 16.4 MB COBOL asset. Retain the 8 MiB maximum until the runtime limit is raised.

Useful? React with 👍 / 👎.

@loong10k
loong10k merged commit d778d58 into main Sep 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant